package com.logistics.delivery.entity.model;

import com.logistics.delivery.entity.domain.Delivery;
import com.logistics.inventory.entity.domain.Inventory;
import com.logistics.utils.bean.SaveBasic;
import com.logistics.utils.bean.UserBean;
import com.logistics.utils.tool.DateUtils;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Data
public class DeliverySave extends SaveBasic {

    private String id;

    private String code;

    private Integer reqCode;

    private String pickId;

    private String parent;

    private String pick;

    private String priority;

    private String agv;

    private String type;

    private String status;

    private String startStation;

    private String nextStartStation;

    private String endStation;

    private String siteId;

    private String agvType;

    private String isContainer;

    private BigDecimal unloadHeight;

    private BigDecimal unloadDownloadHeight;

    private BigDecimal containHeight;

    private BigDecimal loadHeight;

    private DeliveryContainerSave deliveryContainer;

    private List<DeliveryContainerSave> deliveryContainers;

    private String zone;

    public DeliverySave() {
    }

    public static DeliverySave build(String priority, String agv, String type, String status, String endStation) {
        DeliverySave deliverySave = new DeliverySave();
        deliverySave.setPriority(priority);
        deliverySave.setAgv(agv);
        deliverySave.setType(type);
        deliverySave.setStatus(status);
        deliverySave.setEndStation(endStation);
        return deliverySave;
    }

    public static DeliverySave build(String type, String priority, String startStation, String endStation,String nextStartStation, String pick, String agvType, String container, String zone) {
        DeliverySave deliverySave = new DeliverySave();
        deliverySave.setType(type);
        deliverySave.setPriority(priority);
        deliverySave.setStartStation(startStation);
        deliverySave.setEndStation(endStation);
        deliverySave.setNextStartStation(nextStartStation);
        deliverySave.setPick(pick);
        deliverySave.setAgvType(agvType);
        deliverySave.setZone(zone);
        DeliveryContainerSave deliveryContainerSave = new DeliveryContainerSave();
        deliveryContainerSave.setPick(pick);
        deliveryContainerSave.setContainerLevel(1);
        deliveryContainerSave.setIsEmpty(false);
        deliveryContainerSave.setContainer(container);
        deliverySave.setDeliveryContainer(deliveryContainerSave);
        return deliverySave;
    }

    public static DeliverySave build(String type, String startStation, String endStation, String agvType,
                                     BigDecimal unloadHeight, BigDecimal unloadDownloadHeight,String zone) {
        DeliverySave deliverySave = new DeliverySave();
        deliverySave.setType(type);
        deliverySave.setStartStation(startStation);
        deliverySave.setEndStation(endStation);
        deliverySave.setAgvType(agvType);
        deliverySave.setUnloadHeight(unloadHeight);
        deliverySave.setUnloadDownloadHeight(unloadDownloadHeight);
        deliverySave.setZone(zone);
        return deliverySave;
    }

    public static DeliverySave build(String pick, String priority, String type, String startStation, String endStation, String agvType, String isContainer, DeliveryContainerSave deliveryContainerSave) {
        DeliverySave deliverySave = new DeliverySave();
        deliverySave.setPick(pick);
        deliverySave.setPriority(priority);
        deliverySave.setType(type);
        deliverySave.setStartStation(startStation);
        deliverySave.setEndStation(endStation);
        deliverySave.setAgvType(agvType);
        deliverySave.setIsContainer(isContainer);
        deliverySave.setDeliveryContainer(deliveryContainerSave);
        return deliverySave;
    }

    public static DeliverySave build(String pick, String priority, String type, String startStation, String endStation, String agvType, String isContainer, String zone, DeliveryContainerSave deliveryContainerSave) {
        DeliverySave deliverySave = new DeliverySave();
        deliverySave.setPick(pick);
        deliverySave.setPriority(priority);
        deliverySave.setType(type);
        deliverySave.setStartStation(startStation);
        deliverySave.setEndStation(endStation);
        deliverySave.setAgvType(agvType);
        deliverySave.setIsContainer(isContainer);
        deliverySave.setDeliveryContainer(deliveryContainerSave);
        deliverySave.setZone(zone);
        return deliverySave;
    }

    public static DeliverySave build(DeliveryContainerSave deliveryContainerSave,String station, String location, String priority, String type, String status, String isContainer, String agvType) {
        DeliverySave deliverySave = new DeliverySave();
        deliverySave.setStartStation(station);
        deliverySave.setEndStation(location);
        deliverySave.setPriority(priority);
        deliverySave.setType(type);
        deliverySave.setStatus(status);
        deliverySave.setIsContainer(isContainer);
        deliverySave.setAgvType(agvType);
        deliverySave.setDeliveryContainer(deliveryContainerSave);
        return deliverySave;
    }

    public static DeliverySave build(String type, String parent,String zone, String startStation, String endStation,
                                     BigDecimal loadHeight, BigDecimal containHeight, String agvType, UserBean userBean) {
        DeliverySave deliverySave = new DeliverySave();
        deliverySave.setType(type);
        deliverySave.setParent(parent);
        deliverySave.setZone(zone);
        deliverySave.setStartStation(startStation);
        deliverySave.setEndStation(endStation);
        deliverySave.setAgvType(agvType);
        deliverySave.setLoadHeight(loadHeight);
        deliverySave.setContainHeight(containHeight);
        deliverySave.setCreateDepCode(userBean.getDep());
        deliverySave.setCreateOrgCode(userBean.getOrganization());
        deliverySave.setCreator(userBean.getUserCode());
        deliverySave.setCreateTime(DateUtils.dateToStringFormat(new Date(), DateUtils.YYYY_MM_DD_HH_MM_SS));
        deliverySave.setUpdater(userBean.getUserCode());
        deliverySave.setUpdateTime(DateUtils.dateToStringFormat(new Date(), DateUtils.YYYY_MM_DD_HH_MM_SS));
        return deliverySave;
    }

}
